package service

import (
	"os"

	"cashway.com/cis/assistant/model"
	"cashway.com/cis/assistant/utils"
	"github.com/sirupsen/logrus"
)

func SftpUploadFileToRemote(params *model.SftpUploadFileParams) error {
	err := utils.SftpUploadFile(params)
	if err == nil {
		// 不区分删除成功或失败
		err := os.Remove(params.LocalFilePath)
		if err != nil {
			logrus.Errorf("上传至远程端后删除本地文件失败: %s", params.LocalFilePath)
		}
	}
	return err
}
